function sz = size(A,N)
% BVQXfile::size  - overloaded method

% Version:  v0.7b
% Build:    7083015
% Date:     Aug-30 2007, 3:32 PM CEST
% Author:   Jochen Weber, Brain Innovation, B.V., Maastricht, NL
% URL/Info: http://wiki.brainvoyager.com/BVQXtools

% get size
csz = size(struct(A));
csl = length(csz);

% without dim
if nargin < 2
    sz = csz;
elseif ~isa(N, 'double') || ...
    numel(N) ~= 1 || ...
    isinf(N) || ...
    isnan(N) || ...
    N < 1 || ...
    N > 63
    error( ...
        'BVQXfile:BadArgument', ...
        'Invalid call to size.' ...
    );
else
    N = fix(N);
    if N > csl
        sz = 1;
    else
        sz = csz(N);
    end
end
